<?php
	include_once('controller/userController.php');
	//include_once('controller/notif_lakuController.php');
?>

<!DOCTYPE html>
<html>
<head>
<title>Beranda</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.css" />
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script language="JavaScript" type="text/javascript">
	//--------------- LOCALIZEABLE GLOBALS ---------------
	var d=new Date();
	var monthname=new Array("Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember");
	//Ensure correct for language. English is "January 1, 2004"
	var TODAY = d.getDate() + " " + monthname[d.getMonth()] + " " + d.getFullYear();
	//---------------   END LOCALIZEABLE   ---------------
</script>

</head>
<body>
<div id="wrapper">
	<div id="header">
		<img src="images/mm_health_photo1.jpg" alt="Header image"/>
		<h2>-SAYCO-</h2>
		<h3>PORTAL AGRIBISNIS KELOMPOK TANI</h3>
		
	</div> <!-- end head -->
	<div id="date_user">
		
		<div id="dateformat">
			<script language="JavaScript" type="text/javascript">document.write(TODAY);</script>
		</div>
		<div id="login">
			<?php
			if(isset($error_login))
			{
				echo '<div class="alert alert-error" id="alert">'.$error_login.' <button type="button" class="close" data-dismiss="alert" id="close">×</button></div>';
			}
			if(!isset($_SESSION['login'])){
				session_start();
			}
			if(isset($_SESSION['login'])){
				include_once('controller/notif_lakuController.php');
				
				echo "<div id=\"Terimakasih Anda telah Login\">";
				
				echo "  Welcome, ".$_SESSION['username']." || ";
				
				if($data_notif!=0)
				{
					foreach($data_notif as $jml_notif)
					{
						if($jml_notif['jumlah']!=0)
							echo "<font id=\"blink\"><a class=\"btn btn-info\" href=\"laku.php?lihat=true\">".$jml_notif['jumlah']." Transaksi</a></font> ||  ";
							//echo "<script language=\"javascript\" type=\"text/javascript\">
							//		alert('Barang Terjual, silahkan klik notifikasi untuk melihat');
							//	</script>";
					}
				}
				echo "<a class=\"btn\" href=\"logout.php\">Logout</a>";
				echo "</div>";
			}
			else
			{
			?>
			<form method="post" action="#">
				<div id="input_login" class="input-prepend">
				<span class="add-on">Username</span>
				<input class="span2" name="username" id="username" size="16" type="text" placeholder="Username">
				</div>
				&nbsp;
				<div id="input_login" class="input-prepend">
				<span class="add-on">Password</span>
				<input class="span2" name="password" id="password" size="16" type="password" placeholder="Password">
				</div>
				<div id="input_login" class="input-prepend">
				<button class="btn" name="login" type="submit">Login</button>
				<!--<button class="btn" name="daftar" type="button">Register</button> -->
				</div>
			</form>
			<?php
			}
			?>
		</div>

	</div> <!-- end date -->
	<div id="isi">
		<div id="sidebar_left">	
			<ul class="nav nav-pills nav-stacked">
				<li>&nbsp;</li>
				
        <li><a href="index.php">Beranda</a></li>
				<li><a href="berita.php">Informasi</a></li>
				<li><a href="viewpengetahuan.php">Pengetahuan</a></li>
				<?php
				if(!isset($_SESSION['login'])){ 
				?>
				<li> <a href="registrasi.php">Pendaftaran</a></li>
				<?php
				}
				?>
				<?php
				if(isset($_SESSION['login'])){ 
				?>
				<li> <a href="biodata.php">Biodata</a></li>
				<?php
				}
				?>
				<?php
				if(isset($_SESSION['login'])){ 
				?>
				<li> <a href="geraiku.php">Geraiku</a></li>
				<?php
				}
				?>
				<?php
				if(isset($_SESSION['login'])){ 
				?>
				<li> <a href="daftar_pembelian.php">History Pembelian</a></li>
				<?php
				}
				?>
				<li> <a href="produk.php">Jual Beli</a></li>
				<li> <a href="keranjang.php">Keranjang Belanja</a></li>
				<li> <a href="testimoni.php">Testimoni Pelanggan</a></li>
				<li> <a href="laku.php">Konfirmasi Belanja</a></li>
				<li> <a href="notifikasipembayaran.php">Notifikasi Pembayaran</a></li>			  
				<!--<li> <a href="info.php">Pengetahuan</a></li> -->
				<li> <a href="tentangkami.php">Tentang Kami</a></li>
				<?php
				if(isset($_SESSION['login']) && $_SESSION['level']==1){ 
				?>
				<li class="nav-header">Menu Admin</li>
				<li><a href="user_admin.php?admin">Manajemen User</a></li>
				<li><a href="carosel.php?admin">Manajemen Carosel</a></li>
				<li><a href="berita_admin.php?admin">Manajemen Berita</a></li>
				<li><a href="manajemenpengetahuan.php?admin">Manajemen Pengetahuan</a></li>
				<li><a href="manajemententangkami.php?admin">Manajemen Tentang Kami</a></li>
				<?php
				}
				?>
			</ul>
</div>
			<div id="content">

